package com.zhiyu.middle.rocketmq.consumer;

import com.zhiyu.middle.rocketmq.entity.OrderPaidEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

/**
 * 事物消息消费者
 */
@Slf4j
@Service
@RocketMQMessageListener(consumeMode = ConsumeMode.CONCURRENTLY, topic = "tx-topic", consumerGroup = "my-consumer_tx-text-topic", messageModel = MessageModel.CLUSTERING)
public class TransactionRocketMQConsumer implements RocketMQListener<OrderPaidEvent> {

    @Override
    public void onMessage(OrderPaidEvent message) {
        log.info("消费端接收到事务消息：{}", message.toString());
    }

}
